<!--
 * @Author: DUST
 * @Date: 2023-05-16 16:26:54
 * @LastEditors: DUST
 * @LastEditTime: 2023-05-16 16:26:58
 * @FilePath: \vite-project\src\components\tableTopBtns.vue
 * @Description: 
 * undefined
-->
<template>
  <template v-for="(item, i) in list">
    <a-button
      v-if="item.isShow ? showButton(item.isShow) : true"
      :key="i"
      :type="item.type"
      class="ml10"
      @click="item?.func"
    >
      {{ item.name }}
    </a-button>
  </template>
</template>

<script setup lang="ts">
import { IButton } from '@/interface';
// import { getIsShowAction } from "@/utils";

const props = withDefaults(
  defineProps<{
    list: IButton[];
  }>(),
  {}
);

const showButton = (bool: boolean | (() => boolean)) => {
  if (typeof bool === "boolean") return bool;
  if (typeof bool === "function") return bool();
};
</script>

<style scoped></style>
